using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;

namespace SpoonCore.Crypt
{
	class AESCrypt : ICrypt
	{
		private ICryptoTransform _decryptor;
		private ICryptoTransform _encryptor;

		public AESCrypt()
		{
			RijndaelManaged des = new RijndaelManaged();
			_encryptor = des.CreateEncryptor(des.Key, des.IV);
			_decryptor = des.CreateDecryptor(des.Key, des.IV);
		}

		public byte[] Encrypt(byte[] data)
		{
			return _encryptor.TransformFinalBlock(data, 0, data.Length);
		}

		public byte[] Decrypt(byte[] data)
		{
			return _decryptor.TransformFinalBlock(data, 0, data.Length);
		}
	}
}
